<legend><h3>User</h3></legend>

<a href="#myModal" role="button" class="btn" data-toggle="modal"><i class="icon-user"></i>Add User</a>

<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4>Tambah User Baru</h4>
    </div>
    <div class="modal-body">
        <?php
        $f = array('class' => 'form-horizontal');
        echo form_open('user/tambahUser', $f);
        ?>
        <div class="control-group">
            <label class="control-label" for="username">username</label>
            <div class="controls">
                <input type="text" id="username" placeholder="username" name="username">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="inputPassword">Password</label>
            <div class="controls">
                <input type="password" id="inputPassword" placeholder="Password" name="password">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="group">Mikrotik Profile</label>
            <div class="controls">
                <input type="text" id="group" placeholder="Profile" name="profile" value="<?
                if ('NULL') {
                    echo "default";
                }
                ?>">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="masaAktif">Masa Aktif</label>
            <div class="controls">
                <input type="text" id="masaAktif" placeholder="Masa Aktif" name="masaAktif">
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="telepon">Nomor HP</label>
            <div class="controls">
                <input type="text" id="telepon" placeholder="No HP" name="no" value="+62">
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
                <button type="submit" class="btn" name="daftar" value="daftar">Daftar</button>
            </div>
        </div>
<?php echo form_close(); ?>
    </div>
</div>
<!--<form class="form-search pull-right" action="<? //echo site_url() . "user/cari"; ?>" method=GET>
    <input type="text" class="input-medium search-query" name=cari>
    <button type="submit" class="btn" value="cari">Search</button>
</form>-->
<div class="clear">&nbsp;</div>

<?
if (isset($isi)) {
    $link = "<a href=" . site_url() . 'user/hapusSemua' . "><div class=" . '"btn btn-danger"' . " onClick=" . '"return confirm(' . "'Apa Anda yakin akan menghapus semua data?'" . ")" . '">Kosongkan Data</div></a><br><br>';
    echo $link;
    ?>

    <table class="table table-bordered">
        <th>Nama</th>
        <th>Masa Aktif</th>
        <th>No hape</th>
        <th>Action</th>
        <?
        foreach ($table as $nganu) {
            if ($nganu->attribute == 'Expiration') {
                ?>
                <tr>
                    <td width="20%"><?php echo $nganu->username; ?></td>
                    <td width="30%"><?php echo $nganu->value; ?></td>
                    <td width="30%">
                        <?
                        foreach ($telpon as $tlp) {
                            if ($tlp->username == $nganu->username) {
                                echo $tlp->telpon;
                            }
                        }
                        ?>
                    </td>
                    <td><center><a href="<? echo site_url() . "user/hapusUser/" . $nganu->id; ?>"><img src="<?php echo base_url() . 'assets/img/delete.png' ?>" alt="hapus" onClick="return confirm('Apa Anda yakin akan menghapus user <? echo $nganu->username; ?>?')"></a></center></td>
            </tr>
            <?
        } else {
            //NULL;
        }
    }
    echo $links;
} else {
    echo "<br><div class='alert alert-success'>Data Pelanggan Berhasil Dikosongkan<br></div>";
    echo "<div class='alert alert-error'>Data Pelanggan Kosong</div>";
}
?>
</table>
